<template>
  <div>
    <el-dialog
      title="评审记录"
      :visible.sync="dialogVisible"
      :close-on-click-modal="false"
      width="800px"
      @closed="resetForm()"
    >
      <div class="experts-wrap" v-for="v in tableData" :key="v.id">
        <div class="experts-info">
          <el-row :gutter="20">
            <el-col :span="8">
              <p>专家：{{ v.expertsTaskList[0].expertsInfo.userName }}</p>
            </el-col>
            <el-col :span="8">
              <div class="status">
                评审意见：
                <span class="color-success" v-show="v.expertsTaskList[0].status == 1"
                  >建议通过</span
                >
                <span class="color-danger" v-show="v.expertsTaskList[0].status == 2"
                  >建议修改后通过</span
                >
              </div>
            </el-col>
            <el-col :span="8">
              <p>创建时间：{{ v.createTime }}</p>
            </el-col>
          </el-row>
        </div>
        <div class="score">
          <p class="score-log">评分记录 :</p>
          <ul>
            <li v-for="m in v.expertsTaskList.expertsTaskItemList" :key="m.id">
              <p>{{ m.scoreContent }} : {{ m.score }}</p>
            </li>
          </ul>
        </div>

        <div class="approver-opinion" v-html="v.expertsTaskList[0].content"></div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">关 闭</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import { expertsTaskQuery } from "@/api/admin/audit/expertsTask.js";
import Bus from "@/utils/bus.js";
export default {
  data() {
    return {
      dialogVisible: false,
      tableData: [],
    };
  },
  mounted() {
    Bus.$on("showDialogExpertAdvice", (v) => {
      this.getList(v);
    });
  },
  beforeDestroy() {
    Bus.$off("showDialogExpertAdvice");
  },
  methods: {
    getList(v) {
      expertsTaskQuery({ flowTaskId: v.id }).then((res) => {
        if (res.data.count == 0) {
          this.$message({
            message: "暂无评审记录",
            type: "warning",
          });
          return;
        }
        this.tableData = res.data.data;
        this.dialogVisible = true;
      });
    },
    //重置表单
    resetForm() {
      this.checkedData = {};
    },
  },
};
</script>
<style scoped>
.experts-wrap {
  margin-bottom: 20px;
}
.experts-info {
  margin-bottom: 10px;
}
.score {
  margin-bottom: 10px;
}
.score ul li {
  /* text-indent: 2em; */
  line-height: 2;
}
.approver-opinion {
  width: 100%;
  min-height: 300px;
  padding: 0 10px;
  border: 1px solid #eee;
  box-sizing: border-box;
}
</style>